package com.yanqu.road.logic.activity.foxcard.game.buff;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardType;

import java.util.Collections;
import java.util.List;

/**
 * 打出牌并计分时起效果,额外触发次数不是计分时,是所有能触发的都再触发一次
 * 筹码|乘筹码|倍率|乘倍率|金币|额外触发次数
 */
public class FoxCardBuff1 extends FoxCardBuffBase {
    @Override
    protected boolean buffHandle(FoxCardGameLogic gameLogic) {
        int exTimes = buffConfig.getParamsList().get(5);
        if (triggerType == eFoxCardTriggerType.SCORE || (triggerType == eFoxCardTriggerType.AFTER_SCORE && baseCard.getCardType() == eFoxCardType.EFFECT.getValue())) {
            List<FoxBaseCard> settleCards = Collections.singletonList(baseCard);

            int addBaseScore = buffConfig.getParamsList().get(0);
            int addBaseScoreMulti = buffConfig.getParamsList().get(1);
            int addBaseMulti = buffConfig.getParamsList().get(2);
            int addBaseMultiMulti = buffConfig.getParamsList().get(3);
            int goldChange = buffConfig.getParamsList().get(4);


            gameLogic.addBaseScore(addBaseScore, settleCards, null); //加基础筹码
            gameLogic.addBaseScoreMulti(addBaseScoreMulti, settleCards, null); //当前基础筹码乘算
            gameLogic.addBaseMulti(addBaseMulti, settleCards, null); //加基础倍率
            gameLogic.addBaseMultiMulti(addBaseMultiMulti, settleCards, null); //当前基础倍率乘算
            gameLogic.goldChange(goldChange, settleCards, null, triggerType); //加金币
        }

        if (baseCard instanceof FoxHandCard) {//手牌才会有额外触发次数,代码定死了
            for (int i = 0; i < exTimes; i++) {
                gameLogic.repeatDealHandCardBuff((FoxHandCard) baseCard, triggerType);
            }
        }

        return true;
    }
}
